/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package CiaAerea;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author mbm
 */
public class FaturamentoSerialize implements Serializable {
    
          
        public void listaReservas(final File folder) {
        //ReservaSerialize reserva = new ReservaSerialize();
        for ( File fileEntry : folder.listFiles()) {
        if (fileEntry.isDirectory()) {
            
            listaReservas(fileEntry);
        } else {
            try {
                ObjectInputStream entrada = new ObjectInputStream(new FileInputStream("Reservas/"+fileEntry.getName()));
                //reserva = (ReservaSerialize) entrada.readObject();
                
                
            } catch (IOException ex) {
                Logger.getLogger(FaturamentoSerialize.class.getName()).log(Level.SEVERE, null, ex);
            }
            finally
            {
                //return reserva;
            }
            
        }
      }  
    }  
        public ArrayList<Voo> listaVoos(final File folder) {
        ArrayList<Voo> voo = new ArrayList<>();
       
        for ( File fileEntry : folder.listFiles()) {
        if (fileEntry.isDirectory()) {
            
            listaVoos(fileEntry);
        } else {
            try {
                ObjectInputStream entrada = new ObjectInputStream(new FileInputStream("Voos/"+fileEntry.getName().toString()));
                
                
                
                voo.add((Voo) entrada.readObject());
                             
                
            } catch (    IOException | ClassNotFoundException ex) {
                System.err.println(ex.getMessage());
                // Logger.getLogger(FaturamentoSerialize.class.getName()).log(Level.SEVERE, null, ex);
            }
            
            
        }
    }
   
   return voo;
  }




   
}


